package cn.lyjuan.payment.third.base.model.chl.service;

import cn.lyjuan.base.util.SpringContextHolder;
import cn.lyjuan.payment.third.base.common.enums.impl.ChlEnum;
import cn.lyjuan.payment.third.base.model.chl.domain.AppChlModel;
import org.springframework.stereotype.Component;

@Component
public class AppChlService
{
    /**
     * 查询
     * @param appId
     * @param chlType
     * @return  如果不存在返回null
     */
    public AppChlModel query(Integer appId, ChlEnum chlType)
    {
        AppChlModel model = newInstance();

        boolean exist = model.query(appId, chlType);

        return exist ? model : null;
    }

    private AppChlModel newInstance()
    {
        return SpringContextHolder.getBean(AppChlModel.class);
    }
}
